package com.system.demo.controller;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.system.demo.dao.IReadRoomDao;
import com.system.demo.model.ReadRoom;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("readroom")
@Api(tags = "资源室管理模块")
public class ReadRoomController {

	@Resource
	private IReadRoomDao readRoomDao;
	
	@ApiOperation(value = "查询",notes = "查询资源室")
	@GetMapping
	public Map findAll() {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("code", 0);
		map.put("data", readRoomDao.findAll());
		return map;
	}
	
	@ApiOperation(value = "保存",notes = "增删改")
	@PostMapping
	public String save(ReadRoom r) {
		readRoomDao.save(r);
		return "success";
	}
	
}
